//
//  RightViewController.m
//  XDLookPic
//
//  Created by xiaorui on 14-4-17.
//  Copyright (c) 2014年 XD-XY. All rights reserved.
//

#import "RightViewController.h"
#import "XRDetailsViewController.h"
#import "AppDelegate.h"

@interface RightViewController ()

@end

@implementation RightViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
//    self.navigationBarView.hidden = YES;
    
    headView =creatXRImageView(CGRectMake(120, 6, 80, 80), [UIImage imageNamed:@"Icon.png"]);
    [self.contentView addSubview:headView];
    UILabel *nameLabel=creatXRLable(@"芭比汪星", CGRectMake(VIEW_POINT_MIN_X(headView)-3,VIEW_POINT_MAX_Y(headView),80,30));
//    nameLabel.font =[UIFont systemFontOfSize:16.0f];
    [self.contentView addSubview:nameLabel];
    UIButton *bnt = creatXRButton(CGRectMake(VIEW_POINT_MIN_X(nameLabel), VIEW_POINT_MAX_Y(nameLabel), 80, 35), nil, [UIImage imageNamed:@"Icon.png"], [UIImage imageNamed:@"Icon.png"]);
    [bnt addTarget:self action:@selector(detailsButtonClick:) forControlEvents:UIControlEventTouchUpInside];
    [self.contentView addSubview:bnt];

    
    dataArray =[[NSMutableArray alloc]initWithCapacity:0];
    mTableView =[[UITableView alloc]initWithFrame:CGRectMake(0, VIEW_POINT_MAX_Y(bnt)+3, UI_SCREEN_WIDTH, UI_SCREEN_HEIGHT -123 -20-49) style:UITableViewStylePlain];
    mTableView.dataSource =self;
    mTableView.delegate = self;
    [self.contentView addSubview:mTableView];
    
}
-(void)detailsButtonClick:(UIButton *)sender{
    DDLOG_CURRENT_METHOD;
    XRDetailsViewController *detilsVC=[[XRDetailsViewController alloc]init];
    UINavigationController *nav =[[UINavigationController alloc]initWithRootViewController:detilsVC];
    [self presentViewController:nav animated:YES completion:^{
        
    }];
//    AppDelegate *app =(AppDelegate *)[[UIApplication sharedApplication]delegate];
//    
//    [app.revealSideViewController pushViewController:nav onDirection:PPRevealSideDirectionRight withOffset:UI_SCREEN_WIDTH animated:YES];
}
#pragma  mark tableView delegate datasouce
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *ID =@"ID";
    UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:ID];
    if(!cell){
        cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
    }
    return cell;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return dataArray.count;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{

}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    return 44;
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
